package org.road0329.tools.proto_parse_tool.enums;

/**
 * 采集数据项
 */
public enum DataItemEnum  {
    WATER_BM(30, "水累计量 "),

    GAS_CUMULANT(36,"天然气累计量"),

    HOT_WATER_CUMULANT(40, "水量"),

    HEAT_INSTANT_POWER(51, "热功率"),
    HEAT_INSTANT_IN_WATER_TEMP(52,"供水温度"),
    HEAT_INSTANT_OUT_WATER_TEMP(53,"回水温度"),

    HEAT_CUMULANT(96,"累积热量"),
    HEAT_INSTANT_FLOW(97,"瞬时流量"),
    HEAT_CUMULANT_FLOW(98,"累积流量");

    private final int    value;
    private final String text;

    DataItemEnum(int value, String text) {
        this.value = value;
        this.text = text;
    }

    public int getValue() {
        return value;
    }

    public String getText() {
        return text;
    }

    public static String getText(short value) {
        DataItemEnum em = getEnmuByValue(value);
        return em == null ? null : em.getText();
    }

    public short getShortValue() {
        return (short) value;
    }

    /**
     * 通过传入的字符串匹配枚举，传入值
     * 
     * @param value
     * @return
     */
    public static DataItemEnum getEnmuByValue(short value) {
        for (DataItemEnum lowCommType : DataItemEnum.values()) {
            if (value == lowCommType.getValue()) {
                return lowCommType;
            }
        }
        return null;
    }

}
